<!-- 进出登记 定位卡信息 -->
<template>
	<view class="main-box">
		<view class="main-box-item">
			<view class="box-info-label">
				<image src="/static/img/icon/icon_binding.png" class="img" mode="aspectFill" @click="scanCode"></image>
				扫描定位卡
			</view>
			<view class="img-box">
				<image src="/static/img/icon/icon-scan.png" class="img" mode="aspectFill" @click="scanCode"></image>
			</view>
		</view>

	</view>

</template>

<script>
	import indexHandler from '@/pages/index/index.js'
	import {
		IsJson
	} from '@/common/util.js'
	export default {
		props: ['item'],
		data() {
			return {
				cardData: {},
			}
		},

		mounted() {},
		methods: {
			scanCode() {
				let _self = this;
				indexHandler.scanCode().then((e) => {
					if (e.tag) {
						if ((!!e.msg) && e.msg.length > 0) {
							_self.cardData.cardcode = e.msg;
							if ((!!_self.cardData.cardcode) && _self.cardData.cardcode.length > 0) {
		// 发送定位卡code
								uni.$emit("card-code-refresh", {
									key: true,
									msg: e.msg // 定位卡数据
								})
						 
							} else {
								uni.showModal({
									content: '定位卡信息错误',
									showCancel: false
								})
							}


						} else {
							// 信息错误
							uni.showModal({
								content: '信息错误',
								showCancel: false
							})
						}
					} else {
						uni.showModal({
							content: e.msg,
							showCancel: false
						})
					}
				})

			},

		}
	}
</script>

<style lang='scss' scoped>
	.main-box {
		flex: 1;
		overflow: scroll;
		background: #FFFFFF;
		/* padding: 15px; */
		/* padding-top: 55px; */
		height: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.main-box-item {
		display: flex;
		align-items: center;
		width: calc(100% - 60px);
		height: 220rpx;
		background: #FFFFFF;
		/* box-shadow: 0px 2px 5px #F0F0F0; */
		/* border-radius: 4px; */
		vertical-align: middle;
		margin: 10px;

		border-radius: 13px;
		border-color: #1389f1;
		box-shadow: 0 1px 5px 2px #888888;
		border: 1px solid #DCDFE6;


		.box-info-label {
			margin: 0 10px;
			font-size: 14px;
			font-weight: 500;
			display: flex;
			align-items: center;

			.img {
				width: 20px;
				height: 20px;
				margin-right: 8px;
			}
		}

		.img-box {
			flex: 0.9;
			background-color: #FFFFFF;
			display: flex;
			justify-content: center;
			align-items: center;

			.img {
				width: 160rpx;
				height: 160rpx;
				border-radius: 16rpx;
			}
		}
	}
</style>
